import 'package:logger/logger.dart';
import 'package:wukongimfluttersdk/common/options.dart';
import 'package:wukongimfluttersdk/entity/msg.dart';
import 'package:wukongimfluttersdk/type/const.dart';
import 'package:wukongimfluttersdk/wkim.dart';
import 'package:get/get.dart';

class MkIm extends GetxController{

  static MkIm get to => Get.find();
  var logger = Logger();

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
  }

  /**
   * 登录
   */
  void login(uid,token){
    WKIM.shared.setup(Options.newDefault(uid,token, addr: '192.168.1.23:5100'));
    WKIM.shared.connectionManager.connect();
  }


  /**
   * 退出登录
   */
  void logout(){
    // isLogout true：退出并不再重连 false：退出保持重连
    WKIM.shared.connectionManager.disconnect(true);
  }
}